﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RSP_Logic.Enum;

namespace RSP_Logic
{
    public static class RSPHandler
    {
        public static int DetermineWinner(int playerOneChoiceInt, int playerTwoChoiceInt)
        {
            var playerOneChoice = (ChoiceEnum)playerOneChoiceInt;
            var playerTwoChoice = (ChoiceEnum)playerTwoChoiceInt;

            // If players have chosen the same hand its a draw
            if (playerOneChoice == playerTwoChoice)
            {
                return -1;
            }

            switch (playerOneChoice)
            {
                case ChoiceEnum.Rock:
                    return playerTwoChoice == ChoiceEnum.Scissor ? 0 : 1;
                case ChoiceEnum.Scissor:
                    return playerTwoChoice == ChoiceEnum.Paper ? 0 : 1;
                case ChoiceEnum.Paper:
                    return playerTwoChoice == ChoiceEnum.Rock ? 0 : 1;
                default:
                    throw new Exception("Not handles scenario");
            }

        }
    }
}
